-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CASMCMS-9225: Create generic API client class #398
Open
mharding-hpe
wants to merge
2
commits into
casmcms-9225-full
Choose a base branch
from
casmcms-9225-03-api-clients
base: casmcms-9225-full
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−11
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mharding-hpe
commented
Dec 17, 2024
mharding-hpe
force-pushed
the
casmcms-9225-03-api-clients
branch
from
December 17, 2024 17:25
c1ee966
to
5493a7d
Compare
mharding-hpe
requested review from
jsl-hpe,
jsollom-hpe,
rbak-hpe and
kumarrahul04
December 17, 2024 17:26
mharding-hpe
force-pushed
the
casmcms-9225-02-endpoints
branch
from
December 17, 2024 17:28
a92800f
to
7c43912
Compare
mharding-hpe
force-pushed
the
casmcms-9225-03-api-clients
branch
from
December 17, 2024 17:28
5493a7d
to
66b20d2
Compare
kumarrahul04
approved these changes
Dec 17, 2024
mharding-hpe
force-pushed
the
casmcms-9225-02-endpoints
branch
from
December 17, 2024 18:41
f6b566b
to
90aa877
Compare
mharding-hpe
force-pushed
the
casmcms-9225-03-api-clients
branch
from
December 17, 2024 18:43
66b20d2
to
3b8b36c
Compare
mharding-hpe
force-pushed
the
casmcms-9225-02-endpoints
branch
from
December 17, 2024 21:17
90aa877
to
725d4a6
Compare
mharding-hpe
force-pushed
the
casmcms-9225-03-api-clients
branch
from
December 17, 2024 21:18
664a1a7
to
6268c27
Compare
mharding-hpe
force-pushed
the
casmcms-9225-02-endpoints
branch
from
December 17, 2024 23:23
725d4a6
to
fda1560
Compare
mharding-hpe
force-pushed
the
casmcms-9225-03-api-clients
branch
from
December 17, 2024 23:25
6268c27
to
36528e1
Compare
This was referenced Dec 18, 2024
Open
mharding-hpe
changed the base branch from
casmcms-9225-02-endpoints
to
casmcms-9225-full
December 18, 2024 22:13
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR creates a generic API client class, built on top of the API endpoint classes from this PR. The
APIClient
is a subclass ofRequestsRetryManager
frombos.common.utils
, and that is a subclasss of theRequestsRetryManager
class from therequests-retry-session
Python package.Basically, the
RetrySessionManager
class can be used to turn any other class into a context manager that contains a requests session, one that is only initialized if it is used. And this request session (and its underlying HTTP adapter) will both be closed out automatically by the context manager.The
bos.common.utils
subclass just specified the default argument values that BOS uses for its requests sessions.The
APIClient
subclass includes a method (get_endpoint
) which will be used to retrieve endpoints for specific API endpoints. It initializes them on demand, and passes in its managed request session. When used as a context manager, it clears its record of the endpoints that it initialized (because the session they are using is also cleaned up when the context manager exits).This will be used as the building block for the API clients coming in the next PRs. Right now, this PR does not modify anything to use this client class.